using RecruitmentAgency.Models.DataProviders;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using RecruitmentAgency.Models.DataTypes;
using System.Collections.Generic;

namespace RecruitmentAgency.Tests.Models.DataProviders
{
    /// <summary>
    ///This is a test class for ExceptionDataProviderTest and is intended
    ///to contain all ExceptionDataProviderTest Unit Tests
    ///</summary>
    [TestClass]
    public class ExceptionDataProviderTest
    {
        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        
        /// <summary>
        ///A test for SearchExceptions
        ///</summary>        
        [TestMethod]        
        public void SearchExceptionsTest()
        {
            ExceptionDataProvider target = new ExceptionDataProvider();
            const string applName = "GIGAPR-90E3B141_RecruitmentAgency, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
            DateTime? beginDate = Convert.ToDateTime("2009-12-13 19:54:47.220");
            DateTime? endDate = Convert.ToDateTime("2009-12-13 19:54:47.220");
            string msg = "Object reference not set to an instance of an object.";
            string targetSite ="at RecruitmentAgency.Models.DataProviders.JobDataProvider.AddJob(";
            string refer = "http://connection.gigawebsolution.com/Cv/ViewCvs";
            string exceptionPath = "C:/Documents and Setting/Giga/My Documents/Visual Studio 2008/Project/RecruitmentAgency/RecruitmentAgency/";
            List<ExceptionLog> expected = new List<ExceptionLog>();
            expected.Add(new ExceptionLog {ApplicationName = applName,ApplicationPath = applName});
            List<ExceptionLog> actual = target.SearchExceptions(applName, beginDate, endDate, msg, targetSite, refer, exceptionPath);
            Assert.AreNotSame(expected, actual);            
        }

        /// <summary>
        ///A test for HandleException
        ///</summary>        
        [TestMethod()]        
        public void HandleExceptionTest()
        {
            ExceptionDataProvider target = new ExceptionDataProvider();
            Exception ex = new Exception("Testing Exception");
            target.HandleException(ex);            
        }
   
    }
}